/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Random;

/**
 * <p>Project: jse2302 - Ex2
 * <p>Powered by webrx On 2023-06-12 17:19:46
 * <p>Created by IntelliJ IDEA
 *
 * @author  webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex6 {
    public static void main(String[] args) {
        int sp = 30;
        Random rand = new Random();
        for (int i = 1; i <= 30; i += 2) {
            //System.out.print(" ".repeat(sp--));
            --sp;
            for (int s = 1; s < sp; s++) {
                System.out.print(" ");
            }

            for (int n = 1; n <= i; n++) {
                System.out.print("\033[" + rand.nextInt(31, 37) + "m*\033[0m");
            }
            System.out.println();
        }

        for (int i = 27; i >= 1; i -= 2) {
            //System.out.print(" ".repeat(sp--));
            ++sp;
            for (int s = 1; s < sp; s++) {
                System.out.print(" ");
            }

            for (int n = 1; n <= i; n++) {
                //System.out.print("*");
                System.out.print("\033[" + rand.nextInt(31, 37) + "m*\033[0m");
            }
            System.out.println();
        }
    }
}
